package com.atguigu.dga230301.governance.demo;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeStampDemo {
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String time1 = "2023-07-04";
        String time2 = "2023-07-03";
        Date time1Date = sdf.parse(time1);
        long time1Stamp = time1Date.getTime();
        System.out.println(time1Stamp);

        Date time2Date = sdf.parse(time2);
        long time2Stamp = time2Date.getTime();
        System.out.println(time2Stamp);

        System.out.println((time1Stamp - time2Stamp)/1000/60/60/24);
    }
}
